<template>
  <div class="flex">
    <h1>{{ type ? 'Canvas五子棋' : 'Dom五子棋' }}</h1>
  </div>
  <Board :key="timer" v-if="!type" @toChange="toChange" @reStart="reStart" ></Board>
  <boardCanvas :key="timer" v-if="type" @toChange="toChange" @reStart="reStart" ></boardCanvas>
</template>

<script>
import Board from './components/board.vue'
import boardCanvas from './components/boardCanvas.vue'

export default {
  name: 'App',
  components: {
    Board,
    boardCanvas
  },
  data() {
    return {
      type: true,
      timer:null
    }
  },
  methods: {
    toChange() {
      this.type = !this.type
    },
    reStart(){
      this.timer = new Date()
    },
  },
}
</script>

<style>
*{
  margin: 0;
  padding: 0;
}
#app {
  font-family: Avenir, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-align: center;
  color: #2c3e50;
  height: 100vh;
  background-image: url('./assets/background.jpg');
  background-size: cover;
  padding-top: 80px;
}

.button-container {
  margin: 10px;
  display: flex;
  flex-direction: column;
  justify-content: space-around;
  height: 200px;
}

button {
  margin: 0 10px;
  font-size: 16px;
  padding: 10px 20px;
  background-color: #6b4724;
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 5px;
}
.flex{
  display: flex;
  justify-content: center;
  align-items: center;
  margin-bottom: 30px;
}
.btn-con {
  display: flex;
  flex-direction: column;
  height: 200px;
  justify-content: space-around;
  position: absolute;
  right: 250px;
  top: 200px;
}
.btn-con button {
  margin-top: 10px;
}
</style>
